#include "spriteactionrun.h"
#include "spriteeditor.h"
#include "imagebutton.h"

const char * SpriteActionRun::NAME = "RunAnimation";
const char * SpriteActionRun::getName(){return NAME;}

void SpriteActionRun::execute()
{
	SpriteEditor* edit = (SpriteEditor*)getContext();
	edit->setRunning(!edit->isRunning());

	ImageButton* ib = (ImageButton*)m_button;
	MasterPanel * mp = (MasterPanel *)m_button->getMasterPanel();
	if(edit->isRunning())
	{
		// set icon stop
		ib->setButtonImage(mp->getImageClip(8));
	}
	else
	{
		// set icon play
		ib->setButtonImage(mp->getImageClip(10));
	}
}
